package com.javalong.affairs.module.main.activity;

import android.os.Bundle;
import android.view.View;

import com.javalong.affairs.R;
import com.javalong.affairs.base.activity.UIHandlerActivity;
import com.javalong.affairs.base.manager.IntentManager;
import com.javalong.affairs.base.ui.ImageTip;
import com.javalong.affairs.base.ui.MainBlockButtons;
import com.javalong.affairs.base.ui.MainBlockButtons.OnButtonClickListener;
import com.javalong.affairs.base.ui.TopTitle;
import com.javalong.affairs.module.notifything.activity.NotificationActivity;
import com.javalong.affairs.module.renwujinzhang.activity.TrackTaskActivity;
import com.javalong.affairs.module.schedule.activity.ScheduleActivity;
import com.javalong.affairs.module.task.activity.TaskSearchActivity;
import com.javalong.affairs.module.userModule.activity.UserInfoActivity;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;

@ContentView(R.layout.activity_main)
public class MainActivity extends UIHandlerActivity implements OnButtonClickListener {
    @ViewInject(R.id.mb_view)
    private MainBlockButtons mb_view = null;
    @ViewInject(R.id.ui_toptitle)
    private TopTitle topTitle;
    @ViewInject(R.id.it_setting)
    private ImageTip it_setting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ViewUtils.inject(this);
        it_setting.setOnClickListener(this);
        mb_view.setOnButtonClickListener(this);
    }

    @Override
    public void onButtonClick(int index) {
        switch (index) {
            case 1:
                IntentManager.doActivity(this, TaskSearchActivity.class);
                break;
            case 6:
                IntentManager.doActivity(this, NotificationActivity.class);
                break;
            case 0:
                IntentManager.doActivity(this, ScheduleActivity.class);
                break;
            case 7:
                TrackTaskActivity.toThisActivity(this);
                break;
        }

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.it_setting:
                IntentManager.doActivity(this, UserInfoActivity.class);
                break;
            default:
                break;
        }
    }

    @Override
    public void onBackPressed() {
        oneMoreOut();
    }

    public void updateMsgCount(int total) {
    }
}
